const path = require('path');
require('events').EventEmitter.defaultMaxListeners = 0;
const webpack = require("webpack");
const utils = {
	assetsPath: function (_path) {
		const assetsSubDirectory = process.env.NODE_ENV === 'production'
			// 生产环境下的 static 路径
			?
			'static'
			// 开发环境下的 static 路径
			:
			'static'

		return path.posix.join(assetsSubDirectory, _path)
	},
	resolve: function (dir) {
		return path.join(__dirname, '..', dir)
	}
}
/* function resolve(dir) {
	return path.join(__dirname, dir)
} */
module.exports = {
	/*   Eslint:false,
	 */
	/* baseUrl: './', */
	assetsDir: 'static',
	lintOnSave: false,
	productionSourceMap: false,
	parallel: false,
	publicPath: './',
	configureWebpack: {
		//支持jquery
		plugins: [
			new webpack.ProvidePlugin({
				$: "jquery",
				jQuery: "jquery",
				"windows.jQuery": "jquery"
			})
		],
	},

	devServer: {
		proxy: {
			'/apitest': {
				target: 'https://www.tunquanquan.com/',
				changeOrigin: true,
				ws: true,
				pathRewrite: {
					"^/apitest": ""
				}
			},
		},
	},
	/*  configureWebpack: config => {
	 	Object.assign(config.resolve, {
	 		alias: {
	 			'@': resolve('./src'),
	 			'@api': resolve('./src/api'),
	 			'@views': resolve('./src/view'),
	 			'@utils': resolve('./src/utils'),
	 		}
	 	});
	 } */
}